package com.gqz.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * 文章信息表
 */
@Data
@Table(name = "blog_article")
public class BlogArticle implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    private Long id;

    //文章封面
    @Column(name = "article_pic")
    private String articlePic;

    //文章名称
    @Column(name = "article_name")
    private String articleName;

    //文章标签
    @Column(name = "article_tag")
    private String articleTag;

    //文章简介
    @Column(name = "article_remark")
    private String articleRemark;

    //文章阅读量
    @Column(name = "article_read_count")
    private Integer articleReadCount = 0;

    //文章状态(0:草稿;1:发布;2:弃用)
    @Column(name = "article_state")
    private Integer articleState;

    //作者ID
    @Column(name = "user_id")
    private Long userId;

    //文章内容
    @Column(name = "article_content")
    private String articleContent;

    //最后更新时间
    @Column(name = "update_time")
    private Date updateTime = new Date();

    //文章类型
    @Column(name = "article_type")
    private Long articleType;

    //文章点赞数
    @Column(name = "article_star_num")
    private Integer articleStarNum;

    //文章评论数
    @Column(name = "article_comment_num")
    private Integer articleCommentNum;

    //是否置顶(0:不置顶;1:置顶)
    @Column(name = "top_state")
    private Integer topState;

    /**
     * @Transient 临时字段
     * 在查询的时候只做数据的存储
     * 不参与删除/新增/修改的数据库字段操作
     */
    //作者名称
    @Transient
    private String realName;

    //文章类型名称
    @Transient
    private String articleTypeName;

    //文章年份
    @Transient
    private String year;

    //文章月份
    @Transient
    private String month;

    //文章日
    @Transient
    private String day;
}
